package com.study.spark.core.scala

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @Description:
 * @Author: LiuQun
 * @Date: 2022/2/14 12:58
 */
object TestObj {
  def main(args: Array[String]): Unit = {

    val sparkConf: SparkConf = new SparkConf().setMaster("local").setAppName("WorldCount")

    val context:SparkContext = new SparkContext(sparkConf);

    val lines:RDD[String] = context.textFile("datas/apache.log")

    val result: RDD[String] = lines.map(str => {
      val array: Array[String] = str.split(" ")
//      array.foreach(println)
      array(6)
    })

//  println("==========================================================")
    result.collect().foreach(println)
    context.stop();
  }
}
